<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<title>{echo admin_title()}</title>
<!--header-->
{template _:header}
</head>
<body>
<div class="layui-layout layui-layout-admin">
<!--top-->
{template _main_top}
<!--nav-->
{template _main_nav}
	<div class="position"><h1>分润汇总</h1></div>
	<div class="layui-body admin-body">
		<div class="admin-content">
			<blockquote class="layui-elem-quote"><font color="red">只统计有效交易，不含间连（第三方支付）</font></blockquote>
			<div class="searcher">
				<form name="sch_form" id="sch_form" method="get" action="{echo \befen\get_url()}">
					<div class="layui-input-inline">
						<select name="trade_gate" id="trade_gate" class="layui-select">
							<option value="">支付通道</option>
							<!--{loop model('Trade')->gates() $key $val}-->
							<option value="{$key}" <!--{if $key == input('param.trade_gate')}-->selected<!--{/if}-->>{$val}</option>
							<!--{/loop}-->
						</select>
					</div>
					<div class="layui-input-inline">
						<input type="text" name="month" id="month" class="layui-input" placeholder="选择月份" value="{$month}" style="width:80px;">
					</div>
					<div class="layui-input-inline"><input type="text" name="agent_name" id="agent_name" class="layui-input" value="" placeholder="代理编号或名称"></div>
					<div class="layui-input-inline layui-left-margin"><button type="submit" id="search" class="layui-btn">查询</button></div>
				</form>
				<div class="clear"></div>
			</div>
			<form name="theform" id="theform" method="post" action="{echo \befen\get_url()}">
			<table class="layui-table">
				<thead>
					<tr>
						<th>代理名称</th>
						<th>代理编号</th>
						<th>分润笔数</th>
						<th>分润总额</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<!--{loop $list $key $val}-->
					<tr id="">
						<td>{$val[agent_name]}</td>
						<td>{$val[agent_no]}</td>
						<td>{$val[trade_count]}</td>
						<td>{$val[trade_commission]}</td>
						<td class="op">
							<a op="detail" lay-url="{echo url('profit/detail', ['agent_id' => $val[agent_id], 'month' => $month])}" class="layui-btn layui-btn-xs layui-btn-normal">查看明细</a>
						</td>
					</tr>
					<!--{/loop}-->
				</tbody>
			</table>
			</form>
			<div class="listpages">{$pagenav}</div>
		</div>
	</div>
</div>
<!--footer-->
{template _:footer}
<style>
.layui-badge {cursor:pointer;}
</style>
<script type="text/javascript">
$('#month').attr('autocomplete', 'off');
layui.use('laydate', function(){
	var laydate = layui.laydate;
	laydate.render({ 
		elem: '#month',
		type: 'month',
		done: function(value, date, endDate){

		},
		ready: function(value, date, endDate){

		},
		change: function(value, date, endDate){
			$('#month').val(value);
			$('.layui-laydate').remove();
		},
	});
});
$('#sch_form input[name=agent_name]').autoComplete({
	url: "{echo url('agent/index')}",
	field: "agent_no",
	value: "{echo input('param.agent_name')}",
	name_hidden: "agent_id",
	value_hidden: "{echo input('param.agent_id')}",
});
$("a[op=detail]").click(function(){
	gotourl($(this).attr('lay-url'));
});
</script>
</body>
</html>